<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const cai = {
        uname: '只因',
        age: 2.5,
        hobbit: ['sing', 'dance', 'rap', 'basketball'],
        fans: {
          uname: 'ikun',
          age: 9999,
          hobbit: ['smoke', 'drink', 'makeHairStyle'],
        },
      }
      //   let feng = cai

      //   feng.uname = 'chicken'

      //   console.log(feng)
      //   console.log(cai)

      //   const feng = {}

      //1.浅拷贝
      //   Object.assign(feng, cai)

      //   console.log(feng.uname)
      //   feng.uname = 'chicken'
      //   console.log(cai)

      //   const feng = { ...cai }
      //   //   console.log(feng)
      //   //   feng.uname = 'chicken'

      //   feng.fans.uname = 'bee'
      //   console.log(cai)

      const feng = {}

      for (let key in cai) {
        feng[key] = cai[key]
      }

      console.log(feng)
    </script>
  </body>
</html>
